package flc.ast.dialog;

import android.content.Context;
import android.view.View;
import android.widget.TextView;

import androidx.annotation.NonNull;

import com.lxj.xpopup.core.AttachPopupView;

import flc.ast.R;

public class EditDialog extends AttachPopupView {
    private TextView tvDelete;
    private TextView tvEdit;


    public EditDialog(@NonNull Context context) {
        super(context);
    }

    @Override
    protected int getImplLayoutId() {
        return R.layout.dialog_edit;
    }

    @Override
    protected void onCreate() {
        super.onCreate();
        initView();
    }

    protected void initView() {
        tvDelete = (TextView) findViewById(R.id.tvDelete);
        tvEdit = (TextView) findViewById(R.id.tvEdit);

        tvDelete.setOnClickListener(new OnClickListener() {
            @Override
            public void onClick(View v) {
                if (listener != null) {
                    listener.clickDelete();
                }
            }
        });

        tvEdit.setOnClickListener(new OnClickListener() {
            @Override
            public void onClick(View v) {
                if (listener != null) {
                    listener.clickEdit();
                }
            }
        });
    }

    private Ilistener listener;

    public void setListener(Ilistener listener) {
        this.listener = listener;
    }

    public interface Ilistener {
        void clickDelete();

        void clickEdit();
    }

}
